<?php
// $Id: login.php 354 2012-05-05 08:13:24Z tomqin@gmail.com $

defined('IN_ARESCMS') or exit('Access Denied!');

class Login_Action extends Action_Admin{

    protected function init(){}

    function onIndex(){
        $error = '';
        if(array_get_string($_POST, 'dosubmit')){
            $username = array_get_string($_POST, 'username');
            $password = array_get_string($_POST, 'password');

            if(User::login($username, $password)){
                $user = User::getInstance();
                $this->renderDialog('登陆成功，正在载入...', '/admin');
            }else{
                $this->renderDialog('用户名或者密码错误');
            }
        }

        $this->setVar('title', '后台管理系统');
        $this->setVar('error', $error);
        $this->render('admin/common_login', true);
    }
}
?>